function W = adjust_vector1(violation,pop,W)
for id = 1:pop
    violation(id,3) = id;
end
sort_violation = quickSort1(violation,1,pop);
for i = 1:pop
   violation(i,4) = find(sort_violation(:,3)==i);
end
mid_index = (pop+1)/2;
for o = 1:pop-1
    j = o+1; 
    if violation(o,4) < mid_index && violation(j,4) < mid_index
        violation(o,5) = 1;
    elseif (violation(o,4) < mid_index && violation(j,4) > mid_index)||(violation(o,4) > mid_index && violation(j,4) < mid_index)
        violation(o,5) = 0;
    elseif violation(o,4) > mid_index && violation(j,4) > mid_index
        violation(o,5) = 2;
    end
end
add_index  = find(violation(:,5)==1);
del_index = find(violation(:,5)==2);
% unchanged_index = find(violation(:,4)==0);
if length(add_index)>length(del_index)
    violation(pop,5) = 2;
    del_index = [del_index;violation(pop,4)];
elseif length(add_index)<length(del_index)
    violation(pop,5) = 1;
    add_index  = [add_index;violation(pop,4)];
end
 W_add = new_weight1(add_index,W);
 W_del = del_weight(del_index,W);
 W = [W_del;W_add];  
 W = sortrows(W);
end